<?php

namespace admin\models;

use Yii;

/**
 * This is the model class for table "mm_user_requirements".
 *
 * @property integer $mr_id
 * @property integer $mu_id
 * @property string $mr_work
 * @property string $mr_ecom
 * @property string $mr_home
 * @property string $mr_edu
 * @property string $mr_looks
 * @property string $mr_figure
 * @property string $mr_house
 * @property string $mr_car
 * @property string $mr_isdissociated
 * @property string $mr_hadchild
 * @property string $mr_issick
 * @property string $mr_withparents
 * @property string $mr_wantchild
 * @property string $mr_quickmerry
 * @property string $mr_merryperiod
 * @property string mr_other
 *
 * @property Info $mu
 */
class UserRequirements extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'mm_user_requirements';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mu_id'], 'integer'],
            [['mr_work', 'mr_ecom', 'mr_home', 'mr_edu', 'mr_looks', 'mr_figure', 'mr_house', 'mr_car', 'mr_isdissociated',
                'mr_hadchild', 'mr_issick', 'mr_withparents', 'mr_wantchild', 'mr_quickmerry', 'mr_merryperiod'],'required'],
            [['mr_isdissociated', 'mr_hadchild', 'mr_issick', 'mr_withparents', 'mr_wantchild', 'mr_quickmerry', 'mr_merryperiod','mr_other'], 'string'],
            [['mr_work', 'mr_ecom', 'mr_home', 'mr_edu', 'mr_looks', 'mr_figure', 'mr_house', 'mr_car','mr_other'], 'string', 'max' => 200],
            [['mu_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserInfo::className(), 'targetAttribute' => ['mu_id' => 'mi_id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'mr_id' => '择偶条件要求id',
            'mu_id' => '用户id',
            'mr_work' => '工作要求',
            'mr_ecom' => '经济要求',
            'mr_home' => '家境要求',
            'mr_edu' => '学历要求',
            'mr_looks' => '外貌要求',
            'mr_figure' => '身材要求',
            'mr_house' => '房子要求',
            'mr_car' => '车子要求',
            'mr_isdissociated' => '是否接受离异、丧偶',
            'mr_hadchild' => '是否接受有小孩',
            'mr_issick' => '是否接受身体不良健康',
            'mr_withparents' => '是否愿意与父母住一起',
            'mr_wantchild' => '是否想要孩子',
            'mr_quickmerry' => '是否接受闪婚',
            'mr_merryperiod' => '计划多久结婚',
            'mr_other'=>'其他'
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getMu()
    {
        return $this->hasOne(UserInfo::className(), ['mi_id' => 'mu_id']);
    }
}
